package mani.threads.sync;

public class Account {
	private int balance;
	
	public void setBalance(int balance){
		this.balance = balance;
	}
	
	public int getBalance(){
		return balance;
	}
	
	public synchronized void addAmount() {
		int temp = balance;
		try {
			Thread.sleep(100);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		balance+=100;
		temp=balance;
	}
	
	public synchronized void withdrawAmount(){
		int temp = balance;
		try {
			Thread.sleep(100);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		balance-=100;
		temp=balance;
	}

}
